import java.util.*;

public class 小红的字符串构造 {
    //https://www.nowcoder.com/practice/3e4b4dabc2e444e384c3ae62ac7dd84e?tpId=376&tqId=10823894&ru=/exam/oj&qru=/ta/15-days-help/question-ranking&sourceUrl=%2Fexam%2Foj%3FquestionJobId%3D10%26subTabName%3Donline_coding_page
    //哈希表 + 字符串, 比较简单的模拟题
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        //set1是来贪心, 把所有元素都用一遍, 第二个set用来随便填元素的
        Set<Character> set = new HashSet<>();
        Set<Character> set1 = new HashSet<>();
        for(int i = 0;i < s.length();i++){
            set.add(s.charAt(i));
            set1.add(s.charAt(i));
        }
        //存储的字符串
        StringBuilder sb = new StringBuilder();
        for(int i = 0;i < s.length();i++){
            char a = s.charAt(i);
            //标记,如果里面找不到不同元素的话, 就说明肯定不满足直接返回 -1
            boolean flag = true;
            //先把所有元素都使用一遍先
            if(set1.size() > 0){
                for(char ch: set1){
                    if(ch != a){
                        sb.append(ch);
                        set1.remove(ch);
                        flag = false;
                        break;
                    }
                }
            }else{
                for(char ch: set){
                    if(ch != a){
                        sb.append(ch);
                        set1.remove(ch);
                        flag = false;
                        break;
                    }
                }
            }

            if(flag){
                System.out.println(-1);
                return;
            }
        }
        System.out.println(sb.toString());

    }
}
